package com.my.mymafengwo.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;

import com.example.smallstrong.mafengwopro.R;
import com.my.mymafengwo.base.WebActivity;

/**
 * ***********************************************
 * author:wgh
 * time:2015/12/2 22:19
 * copyright:
 * name: 游记、今日峰首页面
 * step:
 * ***********************************************
 */
public class TravelNotesActivity extends WebActivity implements View.OnClickListener {
    /**
     * 显示网页的控件
     */
    private WebView webView;
    /**
     * 要显示的网址
     */
    private String url;
    private ImageView ivBack;

    @Override
    protected void loadXml() {
        setContentView(R.layout.activity_travel_note);
    }

    @Override
    protected void getIntentData(Bundle savedInstanceState) {
        Intent intent = getIntent();
        url = intent.getStringExtra("url");
    }

    @Override
    protected void initViews() {
        webView = (WebView) findViewById(R.id.webv);
        ivBack = (ImageView) findViewById(R.id.iv_back);
    }

    @Override
    protected void registerListener() {
        ivBack.setOnClickListener(this);
    }

    @Override
    protected void initData() {
        loadWeb(webView, url);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_back:
                if (webView.canGoBack()) {
                    webView.goBack();
                } else {
                    finish();
                }
                break;
        }
    }
}
